Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backporting] LUCENE-10002: Deprecate IndexSearch#search(Query, Collector) in favor of IndexSearcher#search(Query, CollectorManager) - TopFieldCollectorManager & TopScoreDocCollectorManager #12891

Conversation

zacharymorn
Copy link
Contributor

This PR backports #240 to branch_9x

… of IndexSearcher#search(Query, CollectorManager) - TopFieldCollectorManager & TopScoreDocCollectorManager (apache#240)
@zacharymorn zacharymorn changed the title LUCENE-10002: Deprecate IndexSearch#search(Query, Collector) in favor of IndexSearcher#search(Query, CollectorManager) - TopFieldCollectorManager & TopScoreDocCollectorManager [Backporting] LUCENE-10002: Deprecate IndexSearch#search(Query, Collector) in favor of IndexSearcher#search(Query, CollectorManager) - TopFieldCollectorManager & TopScoreDocCollectorManager Dec 7, 2023
Copy link
Member

@mikemccand mikemccand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @zacharymorn!

@zacharymorn zacharymorn merged commit 59c0f82 into apache:branch_9x Dec 9, 2023
@javanna
Copy link
Contributor

javanna commented Dec 11, 2023

Thanks for merging this @zacharymorn . I am updating Elasticsearch to this change and I came to wonder if we should deprecate the static methods that create collectors. I do agree on exposing top docs collector managers and deprecating the createShared methods, but there are still scenarios in which users create collectors where collector managers are not needed, for instance situations where IndexSearcher#search is not even called.

I wanted to double check what folks are thinking around this. The plan isn't to deprecate direct usage of collectors, correct? I wonder if it is excessive to to now have to create a collector manager to get an instance of a collector manager as follows:

  @Deprecated
  public static TopScoreDocCollector create(int numHits, int totalHitsThreshold) {
    return new TopScoreDocCollectorManager(numHits, null, totalHitsThreshold, false).newCollector();
  }

This method is now deprecated in favour of interacting with Collector managers rather than collectors. I'd like to double check this we are all aligned on this direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants